using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SheZhi : MonoBehaviour
{
    //设置面板
    public GameObject Panel;
    //关闭设置面板的按钮
    public Button ClosePanelBtn;

    //获取设置面板的关闭音乐
    public Toggle CloseMusic;
    //获取背景音乐
    public AudioSource backGroundAudio;

    //获取第一个toggle的图片
    public Transform FirstToggle;
    // Start is called before the first frame update
    void Start()
    {
        //点击设置按钮
        transform.GetComponent<Button>().onClick.AddListener(() => { 
            //打开按钮
            Panel.SetActive(true);
        });
        ClosePanelBtn.onClick.AddListener(CloseTip);
        //点击时，关闭声音
        CloseMusic.onValueChanged.AddListener((bool isOpen) =>
        {
            if (isOpen)
            {
                backGroundAudio.volume = 0;
            }
            else
            {
                backGroundAudio.volume = 1;
            }
        });
    }

    public void CloseTip()
    {
        Panel.SetActive(false);
    }
    void Update()
    {
        
    }
}
